﻿using Enterprises.Wpf.Core.Logs;
using Enterprises.Wpf.Sample.Services;
using Enterprises.Wpf.Sample.ViewModel;
using Enterprises.Wpf.Sample.ViewModel.Main;
using Microsoft.Extensions.DependencyInjection;

namespace Enterprises.Wpf.Sample.Registrar
{
    /// <summary>
    /// 应用程序DI注册
    /// </summary>
    public static class ApplicationDependencyRegistrar
    {
        public static ServiceCollection Registrar(this ServiceCollection services)
        {
            // service
            services.AddSingleton<DataService>();
            
            // NLog
            services.UseNLog();

            // ViewModel
            services.AddTransient<MainViewModel>();  // 主页面
            services.AddTransient<NonClientAreaViewModel>(); // 标题栏菜单
            services.AddTransient<ObservableObjectDemoCtlViewModel>();
            services.AddTransient<ObservableValidatorDemoCtlViewModel>();
            services.AddTransient<RelayCommandDemoCtlViewModel>();
            services.AddTransient<TwinCatSimpleMotionDemoCtlViewModel>();

            return services;
        }
    }
}
